<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="EventEditDlg" widgetVar="EventEditDialog" modal="true" resizable="false" appendTo="@(body)" header="#{message.EditEventTitle}">
            <h:form id="EventEditForm">
                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{eventController.selected != null}">
                        <p:outputLabel value="#{message.EditEventLabel_eventID}" for="eventID" />
                        <p:inputText id="eventID" value="#{eventController.selected.eventID}" title="#{message.EditEventTitle_eventID}" required="true" requiredMessage="#{message.EditEventRequiredMessage_eventID}"/>
                        <p:outputLabel value="#{message.EditEventLabel_eventEndingTime}" for="eventEndingTime" />
                        <p:calendar id="eventEndingTime" pattern="MM/dd/yyyy HH:mm:ss" value="#{eventController.selected.eventEndingTime}" title="#{message.EditEventTitle_eventEndingTime}"  showOn="button"/>
                        <p:outputLabel value="#{message.EditEventLabel_eventName}" for="eventName" />
                        <p:inputText id="eventName" value="#{eventController.selected.eventName}" title="#{message.EditEventTitle_eventName}" />
                        <p:outputLabel value="#{message.EditEventLabel_eventPrivacy}" for="eventPrivacy" />
                        <p:selectBooleanCheckbox id="eventPrivacy" value="#{eventController.selected.eventPrivacy}" />
                        <p:outputLabel value="#{message.EditEventLabel_eventStartingTime}" for="eventStartingTime" />
                        <p:inputText id="eventStartingTime" value="#{eventController.selected.eventStartingTime}" title="#{message.EditEventTitle_eventStartingTime}" />
                        <p:outputLabel value="#{message.EditEventLabel_eventType}" for="eventType" />
                        <p:inputText id="eventType" value="#{eventController.selected.eventType}" title="#{message.EditEventTitle_eventType}" />
                        <p:outputLabel value="#{message.EditEventLabel_createdBy}" for="createdBy" />
                        <p:selectOneMenu id="createdBy" value="#{eventController.selected.createdBy}" >
                            <f:selectItem itemLabel="#{message.SelectOneMessage}"/>
                            <f:selectItems value="#{userController.itemsAvailableSelectOne}"
                                           var="createdByItem"
                                           itemValue="#{createdByItem}"/>
                        </p:selectOneMenu>
                        <p:outputLabel value="#{message.EditEventLabel_eventLocation}" for="eventLocation" />
                        <p:selectOneMenu id="eventLocation" value="#{eventController.selected.eventLocation}" >
                            <f:selectItem itemLabel="#{message.SelectOneMessage}"/>
                            <f:selectItems value="#{addressController.itemsAvailableSelectOne}"
                                           var="eventLocationItem"
                                           itemValue="#{eventLocationItem}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{eventController.update}" value="#{message.Save}" update="display,:EventListForm:datalist,:growl" oncomplete="handleSubmit(args, 'EventEditDialog');"/>
                    <p:commandButton value="#{message.Cancel}" onclick="EventEditDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
